/**
 *  Copyright 2009-2010 Steven Ottenhoff (Dual-IT)
 * 
 *  This file is part of Clazzified.
 *
 *  Clazzified is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  Clazzified is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with Clazzified.  If not, see http://www.gnu.org/licenses/gpl.
 * 
 */
package nl.dualit.clazzified.core.model.attribute;

import java.util.List;
import java.util.Map;
import java.util.Observer;

import nl.dualit.clazzified.core.model.attribute.constraint.IConstraint;
import nl.dualit.clazzified.store.clazz.AttributeFields;

public interface IAttribute {
	public Long getId();
	public void setId( Long id );
	public String getName();
	public void setName( String name );
	public String getDescription();
	public void setDescription( String description );

	/**
	 * Returns the type of the attribute.
	 * 
	 * @return AttributeTypes instance
	 */
	public AttributeTypes getType();
	
	
	/**
	 * Add an observer that will be notified if any of the data
	 * fields changes.
	 * 
	 * @param o
	 */
	public void addObserver( Observer o );
	/**
	 * Remove an observer.
	 * 
	 * @param o
	 */
	public void removeObserver( Observer o );
	/**
	 * Add a new constraint to the attribute.
	 * 
	 * @param name
	 * @param description
	 * @param typeName
	 * @param value
	 */
	public void addConstraint( IConstraint constraint );
	/**
	 * Remove a constraint from the attribute and from persistent
	 * storage.
	 * 
	 * @param constraint
	 */
	public void removeConstraint( IConstraint constraint );
	/**
	 * Get all the constraints owned by this attribute.
	 * 
	 * @return
	 */
	public List<IConstraint> getConstraints();
	
	public boolean checkValue( Object value );
	
	public Map<AttributeFields,String> getDataMap();
	
}
